<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class Sample extends AppModel
{
    //
    public function project(){
        return $this->belongsTo(ReviewProject::class,'review_project_id');
    }

    public function children(){
        return $this->hasMany(ReviewCase::class,'new_sample_id');
    }

    public function communities()
    {
        return $this->belongsToMany(Community::class,'sample_community','community_id','sample_id');
    }

    public function targets()
    {
        return $this->belongsToMany(ProjectTarget::class,'sample_target','project_target_id','sample_id');
    }

    public function cases(){
        return $this->hasMany(ReviewCase::class,'new_sample_id')->field('id,new_sample_id,review_project_id,audit_status,review_status,review_people');
    }
}
